<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.view');
class ReviewsViewAll extends JView
{
//I don't understand why this view have to use this contructor ,otherwise 
	//name=sviewall ==>default.php will not found==>Throw exception code:500-Default not found
	function __construct( $config = array() ) {
	//setting properly name for this view
      $config['name'] = 'all';
      parent::__construct( $config );

   }
	
  function display($tpl = null)
  {
    global $option;
    //get model which set in controller
    $model = &$this->getModel();
    //call function in this model
    $list = $model->getList();
    for($i = 0; $i < count($list); $i++)
    {
      $row =& $list[$i];
      $row->link = JRoute::_('index.php?option=' . $option . 
                           '&id=' . $row->id  . '&view=review');
    }
    //assignRef for list
    $this->assignRef('list', $list);
    //call default.php in tmpl folder because we set layout in controller is 'default'
    parent::display($tpl);
  }
}
?>